package com.zhiyou.crud.service.impl;

import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou.crud.bean.projectstype;
import com.zhiyou.crud.dao.projectstypeMapper;
import com.zhiyou.crud.service.projectstypeService;
@Service
public class projectstypeServiceImpl implements projectstypeService {
@Autowired
projectstypeMapper projectstypemapper;
	@Override
	public List<projectstype> getAll() {
		
		return projectstypemapper.selectAll();
	}
	@Override
	public int addType(@Valid projectstype ptype) {
		
		return projectstypemapper.insertSelective(ptype);
	}
	@Override
	public projectstype getType(Integer id) {
		projectstype pro=new projectstype();
		pro.setPstid(id);
		return projectstypemapper.selectOne(pro);
	}
	@Override
	public int updateType(projectstype pro) {
		return projectstypemapper.updateByPrimaryKeySelective(pro);
	}
	@Override
	public int deleteType(Integer id) {
		
		return projectstypemapper.deleteByPrimaryKey(id);
	}

}
